-- card: 3043 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 2783 -- name: -- part 11 (field) -- low flags: 81 -- high flags: 2004 -- rect: left=59 top=61 right=218 bottom=454 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 2 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Author -- part 12 (button) -- low flags: 80 -- high flags: 8003 -- rect: left=378 top=189 right=211 bottom=446 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: OK ----- HyperTalk script ----- on mouseUp set the visible of card button OK to false set the visible of card field Author to false end mouseUp -- part 10 (field) -- low flags: 81 -- high flags: 0007 -- rect: left=59 top=61 right=218 bottom=453 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 2 -- text size: 12 -- style flags: 0 -- line height: 14 -- part name: Help ----- HyperTalk script ----- on mouseUp set the visible of card field Help to not visible of card field Help end mouseUp -- part 14 (button) -- low flags: 00 -- high flags: A002 -- rect: left=16 top=319 right=340 bottom=76 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Return ----- HyperTalk script ----- on mouseUp global returncard go to returncard end mouseUp -- part contents for card part 10 ----- text ----- Tower of Hanoi Instructions: ( Click on the title "Tower of Hanoi" above to hide this information. ) This stack demonstrates the use of a recursive algorithm to solve the classic Tower of Hanoi problem. The solution involves movement of a stack of disks from one of three poles to another. There are two very simple rules: only one disk can be moved at a time, and no disk can ever be placed on top of a smaller one. Legend has it that there is an order of Tibetan monks who have been laboring patiently for centuries to move a tower of one hundred disks. The completion of their task will bring the end of the universe. Just how worried should you be? You can use this stack to find out. Underneath the title button are four buttons that control the operation of this stack. From left to right they are "Make Tower," "Set Tower," "Move Tower," and "See Algorithm." Click "Make Tower" to create a stack of between 0 and 7 disks. The stack is automatically positioned on the left pole. To reset the position of the stack of disks, click "Set Tower." A dialog box appears giving you the choice of setting the tower on the left, center, or right poles. To move the stack of disks using the Tower of Hanoi algorithm, click "Move Tower." Again a dialog box appears allowing you to select the destination pole. The remaining pole, which is neither the source nor the destination, is automatically used as the auxiliary pole. The current depth of recursion and the number of moves are displayed beneath the base of the disk holder. By testing the operation of the algorithm on towers of different heights, you should be able to determine the maximum depth of recursion and the total number of moves in terms of the number of disks in the stack. (See the script of the title button for the answers, and don't cheat!) To examine the recursive Tower of Hanoi movement handler "moveTower," click "See Algorithm." You may also view the script of the background by typing Command-Option-B to examine the other handlers that support the operation of this stack. Clicking on the title "Tower of Hanoi" above will hide this information when visible, and will otherwise display the authorship of the stack. -- part contents for card part 11 ----- text ----- Written by Jeffry A. Spain, M.D., '71 The HyperSchool Cincinnati Country Day School Attn: Joseph F. Hofmeister Computer Coordinator 6905 Given Road Cincinnati, Ohio 45243 Telephone: 513-561-7298 AppleLink: K0197 -- part contents for background part 49 ----- text ----- Depth of Recursion -- part contents for background part 50 ----- text ----- 0 -- part contents for background part 53 ----- text ----- Number of Moves -- part contents for background part 52 ----- text ----- 0